package com.niknik.woody.utils.cards;

/**
 * User: yoda
 * Date: 15.02.11
 * Time: 17:38
 */
public enum CardSuit {
  NONE("_"),
  SPADES("S"),
  CLUBS("C"),
  DIAMONDS("D"),
  HEARTS("H");

  private final String _value;

  private CardSuit(String value) {
    _value = value;
  }

  public static CardSuit fromString(String value) {
    switch (value.charAt(0)) {
      case 'S':
        return SPADES;
      case 'C':
        return CLUBS;
      case 'H':
        return HEARTS;
      case 'D':
        return DIAMONDS;
      case '_':
        return NONE;
      default:
        throw new IllegalArgumentException("Failed to parse kozir from: " + value);
    }
  }

  @Override
  public String toString() {
    return _value;
  }
}
